<template >
  <div style="width: 100%; background: #ffffff; margin-top: 20px">
    <p
      style="
        font-weight: 900;
        margin-left: 30px;
        margin-right: 10px;
        height: 50px;
        line-height: 50px;
      "
    >
      流水列表
    </p>
    <div>
      <el-table
        ref="multipleTable"
        :data="arr"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column
          property="num"
          label="订单编号"
          width="160"
        ></el-table-column>
        <el-table-column
          property="name"
          label="订单负责人"
          width="120"
        ></el-table-column>
        <el-table-column
          property="biaoti"
          label="标题"
          style="text-align: center"
        ></el-table-column>
        <el-table-column property="money" label="订单金额"></el-table-column>
        <el-table-column
          property="moneygood"
          label="订单状态"
        ></el-table-column>
        <el-table-column
          property="time"
          label="下单时间"
          style="text-align: center"
        ></el-table-column>
      </el-table>
      <div style="margin-top: 20px"></div>
    </div>
  </div>
</template>

<script>
import { batchDeleteApi } from "../../api/routeroneApi";

import eventBus from "@/utils/eventBus";
export default {
  props: ["arr"],
  data() {
    return {
      currentPage4: 1,
      multipleSelection: [],
    };
  },

  mounted() {
    eventBus.$on("batchdelete", this.tablebatchdelete);
  },

  methods: {
    //批量删除
    tablebatchdelete() {
      //√
      console.log("触发函数"); //√
      var ids = this.multipleSelection.map((item) => item.id); //√
      console.log("ids", ids); //√
      batchDeleteApi({ ids: ids }).then((res) => {
        //√
        console.log("res", res); //√
        if (res.code == 200) {
          this.$emit("resetHome");
        }
      });
    },

    handleSelectionChange(val) {
      this.multipleSelection = val;
      console.log(this.multipleSelection);
    },
  },
};
</script>

<style>
.el-table .cell {
  text-align: center;
}

.eee {
  display: flex;
  background: rgb(255, 255, 255);
  align-items: center;
  height: 70px;
  margin-top: -20px;
}

.rrr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 140px;
  margin-left: 18px;
}

.ttt {
  margin: 0 auto;
}
</style>